var mongoose = require('mongoose')

var UserSchema = new mongoose.Schema({
    'userId': String,
    'userName':String,
    'userPwd':String,
    'orderList':[{
        orderId:String,
        orderTotal:String,
        addressInfo:Object,
        goodsList:Array,
        orderStatus:{
            type:Number,
            default:'1'
        },
        createDate:String
    }],
    'addressList':[{
        'addressId': String,
        'userName': String,
        'streetName': String,
        'postCode': String,
        'tel': String,
        'isDefault':Boolean
    }],
    'cartList':[{
        'productId': String,
        'productName':String,
        'salePrice': Number,
        'productNum': {
            type: Number,
            default: '1'
        },
        'checked': {
            type: String,
            default:'1'
        },
        'productImage':String
    }]
})

module.exports = mongoose.model('User', UserSchema)